home *** CD-ROM | disk | FTP | other *** search
/ Champak 128 / Vol 128 (Damaged).iso / games / boiler_b.swf / scripts / DefineSprite_235 / frame_1 / DoAction.as
Encoding:
Text File  |  2011-03-26  |  1.1 KB  |  62 lines

  1. var pNum = Number(this._name.slice(5,-3));
  2. var pX;
  3. var pY;
  4. var pMyPause;
  5. var pAnim;
  6. this.setPos = function(ty)
  7. {
  8.    this._x = pX + 38;
  9.    this._y = pY - ty;
  10. };
  11. this.setUp = function(x, y, rot, frames)
  12. {
  13.    var _loc1_ = this;
  14.    var _loc2_ = rot;
  15.    _loc1_.pX = x * 16;
  16.    _loc1_.pY = y * 16;
  17.    _loc1_._rotation = 90 * _loc2_;
  18.    if(_loc2_ == 1 || _loc2_ == 3)
  19.    {
  20.       _loc1_.pY += 10;
  21.    }
  22.    else if(_loc2_ == 2)
  23.    {
  24.       _loc1_.pY += 20;
  25.    }
  26.    pMyPause = frames * 24;
  27.    _loc1_.pAnim = pMyPause;
  28. };
  29. switch(pNum)
  30. {
  31.    case 0:
  32.       this.setUp(8,7,1,4);
  33.       break;
  34.    case 1:
  35.       this.setUp(34,23,3,5);
  36.       break;
  37.    case 2:
  38.       this.setUp(22,53,3,4);
  39.       break;
  40.    case 3:
  41.       this.setUp(8,76,1,5);
  42.       break;
  43.    case 4:
  44.       this.setUp(18,92,3,4);
  45. }
  46. this.onEnterFrame = function()
  47. {
  48.    var _loc1_ = this;
  49.    pAnim--;
  50.    if(pAnim <= 0)
  51.    {
  52.       pAnim = pMyPause;
  53.       pState = "active";
  54.       if(Math.distance(_loc1_,_loc1_._parent.bod_mc) < 300)
  55.       {
  56.          _loc1_._parent.snd_mc.playsound("pSteam");
  57.       }
  58.       _loc1_.gotoAndPlay(2);
  59.    }
  60. };
  61. stop();
  62.